package com.example.friendcash;

import android.app.Application;
import com.example.friendcash.database.core.Friend;
import com.example.friendcash.database.dao.implementation.sqlite.android.SQLiteDaoFactory;
import com.example.friendcash.database.dao.interfaces.IDaoFactory;
import com.example.friendcash.database.services.implementation.ServiceFactory;
import com.example.friendcash.database.services.interfaces.IServiceFactory;

import java.util.ArrayList;
import java.util.List;

public class BaseApplication extends Application {

    public static final String DATABASE_NAME = "holo-events";

    private IServiceFactory serviceFactory;
    private long eventId;

    private static BaseApplication sInstance = new BaseApplication();
    private long entityId;

    public static BaseApplication getInstance() {
        return sInstance;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        sInstance = this;
        final IDaoFactory daoFactory = new SQLiteDaoFactory(this, DATABASE_NAME);
        serviceFactory = new ServiceFactory(daoFactory);
    }

    public final IServiceFactory getServiceFactory() {
        return serviceFactory;
    }

    public void setEntityId(long entityId) {
        this.entityId = entityId;
    }

    public long getEntityId() {
        return entityId;
    }
}
